<?php
//定义首页路径
define('APP_PATH',dirname($_SERVER['SCRIPT_FILENAME']).'/');
//设置include 目录
set_include_path(APP_PATH.'include');
//包含内核类
include 'db.class.php';
include 'function.php';
include 'model.class.php';
include 'action.class.php';
include 'view.class.php';
$config=include 'config.php';
//include 'config.php';
/*关闭magic_quotes_gpc*/
if(version_compare(PHP_VERSION,'5.4.0','<')) {
    ini_set('magic_quotes_runtime',0);
    define('MAGIC_QUOTES_GPC',get_magic_quotes_gpc()?True:False);
}else{
    define('MAGIC_QUOTES_GPC',false);}
    
/*这里进行URL路由,这里是最简单的路由功能*/
$control=isset($_GET['c'])?strip_tags($_GET['c']):'index';
$action=isset($_GET['a'])?strip_tags($_GET['a']):'index';
$theme=isset($_GET['t'])?strip_tags($_GET['t']):'defalut';

/*简单的路由*/

if(!in_array($control,array('user','index'))){
    die('unregistered control');
}else{
    if(file_exists('./action/'.$control.'Action.class.php')){
         include './action/'.$control.'Action.class.php';
        $nowaction=$control.'Action';
        $nowcontrol=new $nowaction();
         if(method_exists( $nowaction,$action)){
            $nowcontrol->{$action}();
         }else{
          die('Method not exists');
         }
    }else{
      die('Control class not exists');
    }
}

 
